/**
* @description: 周赛312 t2
* @author hewei
* @date 2022/9/25 14:10
* @version 1.0
*/

public class LongestSubarray2 {

    public static void main(String[] args) {
        System.out.println(Integer.toBinaryString(23));
    }

    public int longestSubarray(int[] nums) {
        int ans = 0;
        int temp = 0;
        int max = 0;
        for (int j : nums) {
            max = Math.max(max, j);
        }
        for (int j : nums) {
            if (j == max) {
                ++temp;
            } else {
                ans = Math.max(ans, temp);
                temp = 0;
            }
        }
        ans = Math.max(ans, temp);
        return ans;
    }
}
